{"ast":null,"code":"import classNames from 'classnames';\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport * as React from 'react';\nimport { ConfigContext } from '../config-provider';\nimport SizeContext from '../config-provider/SizeContext';\nimport getDataOrAriaProps from '../_util/getDataOrAriaProps';\nimport { RadioGroupContextProvider } from './context';\nimport Radio from './radio';\nimport useStyle from './style';\nconst RadioGroup = /*#__PURE__*/React.forwardRef((props, ref) => {\n  const {\n    getPrefixCls,\n    direction\n  } = React.useContext(ConfigContext);\n  const size = React.useContext(SizeContext);\n  const [value, setValue] = useMergedState(props.defaultValue, {\n    value: props.value\n  });\n  const onRadioChange = ev => {\n    const lastValue = value;\n    const val = ev.target.value;\n    if (!('value' in props)) {\n      setValue(val);\n    }\n    const {\n      onChange\n    } = props;\n    if (onChange && val !== lastValue) {\n      onChange(ev);\n    }\n  };\n  const {\n    prefixCls: customizePrefixCls,\n    className = '',\n    options,\n    buttonStyle = 'outline',\n    disabled,\n    children,\n    size: customizeSize,\n    style,\n    id,\n    onMouseEnter,\n    onMouseLeave,\n    onFocus,\n    onBlur\n  } = props;\n  const prefixCls = getPrefixCls('radio', customizePrefixCls);\n  const groupPrefixCls = `${prefixCls}-group`;\n  // Style\n  const [wrapSSR, hashId] = useStyle(prefixCls);\n  let childrenToRender = children;\n  // 如果存在 options, 优先使用\n  if (options && options.length > 0) {\n    childrenToRender = options.map(option => {\n      if (typeof option === 'string' || typeof option === 'number') {\n        // 此处类型自动推导为 string\n        return /*#__PURE__*/React.createElement(Radio, {\n          key: option.toString(),\n          prefixCls: prefixCls,\n          disabled: disabled,\n          value: option,\n          checked: value === option\n        }, option);\n      }\n      // 此处类型自动推导为 { label: string value: string }\n      return /*#__PURE__*/React.createElement(Radio, {\n        key: `radio-group-value-options-${option.value}`,\n        prefixCls: prefixCls,\n        disabled: option.disabled || disabled,\n        value: option.value,\n        checked: value === option.value,\n        style: option.style\n      }, option.label);\n    });\n  }\n  const mergedSize = customizeSize || size;\n  const classString = classNames(groupPrefixCls, `${groupPrefixCls}-${buttonStyle}`, {\n    [`${groupPrefixCls}-${mergedSize}`]: mergedSize,\n    [`${groupPrefixCls}-rtl`]: direction === 'rtl'\n  }, className, hashId);\n  return wrapSSR( /*#__PURE__*/React.createElement(\"div\", Object.assign({}, getDataOrAriaProps(props), {\n    className: classString,\n    style: style,\n    onMouseEnter: onMouseEnter,\n    onMouseLeave: onMouseLeave,\n    onFocus: onFocus,\n    onBlur: onBlur,\n    id: id,\n    ref: ref\n  }), /*#__PURE__*/React.createElement(RadioGroupContextProvider, {\n    value: {\n      onChange: onRadioChange,\n      value,\n      disabled: props.disabled,\n      name: props.name,\n      optionType: props.optionType\n    }\n  }, childrenToRender)));\n});\nexport default /*#__PURE__*/React.memo(RadioGroup);","map":{"version":3,"names":["classNames","useMergedState","React","ConfigContext","SizeContext","getDataOrAriaProps","RadioGroupContextProvider","Radio","useStyle","RadioGroup","forwardRef","props","ref","getPrefixCls","direction","useContext","size","value","setValue","defaultValue","onRadioChange","ev","lastValue","val","target","onChange","prefixCls","customizePrefixCls","className","options","buttonStyle","disabled","children","customizeSize","style","id","onMouseEnter","onMouseLeave","onFocus","onBlur","groupPrefixCls","wrapSSR","hashId","childrenToRender","length","map","option","createElement","key","toString","checked","label","mergedSize","classString","Object","assign","name","optionType","memo"],"sources":["/data/messenger.client/node_modules/antd/es/radio/group.js"],"sourcesContent":["import classNames from 'classnames';\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport * as React from 'react';\nimport { ConfigContext } from '../config-provider';\nimport SizeContext from '../config-provider/SizeContext';\nimport getDataOrAriaProps from '../_util/getDataOrAriaProps';\nimport { RadioGroupContextProvider } from './context';\nimport Radio from './radio';\nimport useStyle from './style';\nconst RadioGroup = /*#__PURE__*/React.forwardRef((props, ref) => {\n  const {\n    getPrefixCls,\n    direction\n  } = React.useContext(ConfigContext);\n  const size = React.useContext(SizeContext);\n  const [value, setValue] = useMergedState(props.defaultValue, {\n    value: props.value\n  });\n  const onRadioChange = ev => {\n    const lastValue = value;\n    const val = ev.target.value;\n    if (!('value' in props)) {\n      setValue(val);\n    }\n    const {\n      onChange\n    } = props;\n    if (onChange && val !== lastValue) {\n      onChange(ev);\n    }\n  };\n  const {\n    prefixCls: customizePrefixCls,\n    className = '',\n    options,\n    buttonStyle = 'outline',\n    disabled,\n    children,\n    size: customizeSize,\n    style,\n    id,\n    onMouseEnter,\n    onMouseLeave,\n    onFocus,\n    onBlur\n  } = props;\n  const prefixCls = getPrefixCls('radio', customizePrefixCls);\n  const groupPrefixCls = `${prefixCls}-group`;\n  // Style\n  const [wrapSSR, hashId] = useStyle(prefixCls);\n  let childrenToRender = children;\n  // 如果存在 options, 优先使用\n  if (options && options.length > 0) {\n    childrenToRender = options.map(option => {\n      if (typeof option === 'string' || typeof option === 'number') {\n        // 此处类型自动推导为 string\n        return /*#__PURE__*/React.createElement(Radio, {\n          key: option.toString(),\n          prefixCls: prefixCls,\n          disabled: disabled,\n          value: option,\n          checked: value === option\n        }, option);\n      }\n      // 此处类型自动推导为 { label: string value: string }\n      return /*#__PURE__*/React.createElement(Radio, {\n        key: `radio-group-value-options-${option.value}`,\n        prefixCls: prefixCls,\n        disabled: option.disabled || disabled,\n        value: option.value,\n        checked: value === option.value,\n        style: option.style\n      }, option.label);\n    });\n  }\n  const mergedSize = customizeSize || size;\n  const classString = classNames(groupPrefixCls, `${groupPrefixCls}-${buttonStyle}`, {\n    [`${groupPrefixCls}-${mergedSize}`]: mergedSize,\n    [`${groupPrefixCls}-rtl`]: direction === 'rtl'\n  }, className, hashId);\n  return wrapSSR( /*#__PURE__*/React.createElement(\"div\", Object.assign({}, getDataOrAriaProps(props), {\n    className: classString,\n    style: style,\n    onMouseEnter: onMouseEnter,\n    onMouseLeave: onMouseLeave,\n    onFocus: onFocus,\n    onBlur: onBlur,\n    id: id,\n    ref: ref\n  }), /*#__PURE__*/React.createElement(RadioGroupContextProvider, {\n    value: {\n      onChange: onRadioChange,\n      value,\n      disabled: props.disabled,\n      name: props.name,\n      optionType: props.optionType\n    }\n  }, childrenToRender)));\n});\nexport default /*#__PURE__*/React.memo(RadioGroup);"],"mappings":"AAAA,OAAOA,UAAU,MAAM,YAAY;AACnC,OAAOC,cAAc,MAAM,iCAAiC;AAC5D,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,OAAOC,WAAW,MAAM,gCAAgC;AACxD,OAAOC,kBAAkB,MAAM,6BAA6B;AAC5D,SAASC,yBAAyB,QAAQ,WAAW;AACrD,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAOC,QAAQ,MAAM,SAAS;AAC9B,MAAMC,UAAU,GAAG,aAAaP,KAAK,CAACQ,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAC/D,MAAM;IACJC,YAAY;IACZC;EACF,CAAC,GAAGZ,KAAK,CAACa,UAAU,CAACZ,aAAa,CAAC;EACnC,MAAMa,IAAI,GAAGd,KAAK,CAACa,UAAU,CAACX,WAAW,CAAC;EAC1C,MAAM,CAACa,KAAK,EAAEC,QAAQ,CAAC,GAAGjB,cAAc,CAACU,KAAK,CAACQ,YAAY,EAAE;IAC3DF,KAAK,EAAEN,KAAK,CAACM;EACf,CAAC,CAAC;EACF,MAAMG,aAAa,GAAGC,EAAE,IAAI;IAC1B,MAAMC,SAAS,GAAGL,KAAK;IACvB,MAAMM,GAAG,GAAGF,EAAE,CAACG,MAAM,CAACP,KAAK;IAC3B,IAAI,EAAE,OAAO,IAAIN,KAAK,CAAC,EAAE;MACvBO,QAAQ,CAACK,GAAG,CAAC;IACf;IACA,MAAM;MACJE;IACF,CAAC,GAAGd,KAAK;IACT,IAAIc,QAAQ,IAAIF,GAAG,KAAKD,SAAS,EAAE;MACjCG,QAAQ,CAACJ,EAAE,CAAC;IACd;EACF,CAAC;EACD,MAAM;IACJK,SAAS,EAAEC,kBAAkB;IAC7BC,SAAS,GAAG,EAAE;IACdC,OAAO;IACPC,WAAW,GAAG,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